package o;

import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ProgressBar;
import android.widget.TextView;
import o.bkw.b;
import o.bkw.d;
import o.bkw.e;

public class LoadingController {
    protected View ˊ;
    protected TextView ˋ;
    protected View ˎ;
    protected ProgressBar ˏ;
    protected View ॱ;
    private OnClickListener ॱॱ;
    private bhd ᐝ;

    public View ˏ(LayoutInflater layoutInflater) {
        View inflate = layoutInflater.inflate(b.ॱ, null);
        ˏ(inflate);
        return inflate;
    }

    public void ˏ(bhd o_bhd) {
        this.ᐝ = o_bhd;
    }

    private void ˏ(final View view) {
        this.ˊ = view;
        this.ˊ.setVisibility(8);
        this.ˏ = (ProgressBar) view.findViewById(d.ॱ);
        this.ˋ = (TextView) view.findViewById(d.ʽ);
        this.ˎ = view.findViewById(d.ˊ);
        this.ॱ = view.findViewById(d.ˎ);
        this.ˎ.setOnClickListener(new OnClickListener(this) {
            final /* synthetic */ LoadingController ˋ;

            public void onClick(View view) {
                if (this.ˋ.ॱॱ != null) {
                    this.ˋ.ॱ(view);
                    this.ˋ.ॱॱ.onClick(this.ˋ.ˎ);
                }
            }
        });
    }

    public void ˋ() {
        ॱ(0);
    }

    public void ˎ(OnClickListener onClickListener) {
        this.ॱॱ = onClickListener;
    }

    public void ˏ() {
        if (this.ˏ != null) {
            this.ˏ.clearAnimation();
        }
        ॱ(8);
    }

    public void ˋ(int i, boolean z) {
        String string = ContentManager.getInstant().getContext().getResources().getString(e.ˊ);
        boolean z2 = false;
        if (i == 3) {
            string = ContentManager.getInstant().getContext().getResources().getString(e.ˋ);
            z2 = true;
        }
        ˏ(string, z, z2);
    }

    protected void ॱ(View view) {
        this.ˎ.setClickable(false);
        this.ˏ.setVisibility(0);
        this.ˎ.setVisibility(8);
        if (this.ॱ != null) {
            this.ॱ.setVisibility(0);
        }
    }

    public void ॱ() {
        if (this.ˊ != null) {
            ॱ(this.ˊ);
        }
    }

    public void ॱ(int i, int i2) {
        if (this.ˊ == null) {
            Logger.e("BuoyLoadingController", "onEvent: laodingView is not valid");
        } else if (i != 0 || i2 != 0) {
            ˋ(i, true);
            ॱ(0);
        } else if (this.ˊ.getVisibility() != 8) {
            ॱ(8);
        }
    }

    private void ॱ(int i) {
        if (this.ˊ != null) {
            this.ˊ.setVisibility(i);
        }
    }

    private void ˏ(String str, boolean z, boolean z2) {
        if (this.ˊ == null) {
            Logger.e("BuoyLoadingController", "stopLoading: loadingView is not Valid");
            return;
        }
        if (z2) {
            View findViewById = this.ˊ.findViewById(d.ᐝ);
            findViewById.setVisibility(0);
            findViewById.setOnClickListener(new OnClickListener(this) {
                final /* synthetic */ LoadingController ˏ;

                {
                    this.ˏ = r1;
                }

                public void onClick(View view) {
                    if (this.ˏ.ᐝ != null) {
                        this.ˏ.ᐝ.ʼॱ();
                    }
                }
            });
        } else {
            this.ˊ.findViewById(d.ᐝ).setVisibility(8);
        }
        this.ˏ.setVisibility(8);
        if (this.ॱ != null) {
            this.ॱ.setVisibility(8);
        }
        this.ˎ.setVisibility(0);
        this.ˋ.setText(str);
        if (z) {
            this.ˎ.setClickable(true);
        }
    }
}
